package com.iran.observer.jingzongObserverTest;

public class OberverTest {
    public static void main(String[] args) {
        IObserver chengOberver = new ChengOberver();
        IObserver llaObserver = new LlaObserver();
        ((ChengOberver) chengOberver).setWorking("正在玩儿手机...");
        System.out.println(((ChengOberver) chengOberver).getWorking());

        ((LlaObserver) llaObserver).setWorking("正在玩儿电脑...");
        System.out.println(((LlaObserver) llaObserver).getWorking());

        ISubject liangGeSubject = new LiangGeSubject();
        liangGeSubject.addObserver(llaObserver);
        liangGeSubject.addObserver(chengOberver);

        liangGeSubject.notifyObservers();
        System.out.println(((ChengOberver) chengOberver).getWorking());
        System.out.println(((LlaObserver) llaObserver).getWorking());
    }
}
